//
//  BNDOfficeDocReadCell.m
//  OfficeDoc
//
//  Created by pie on 2022/4/5.
//  Copyright © 2022 pie. All rights reserved.
//

#import "BNDOfficeDocReadCell.h"
#import "UIImageView+LKWebImage.h"
#import "LVUIUtils.h"

@interface BNDOfficeDocReadCell()
@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UIImageView *iconImageView;
@end

@implementation BNDOfficeDocReadCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = UIColor.whiteColor;
        [LVUIUtils addLineInView:self.contentView top:NO leftMargin:16 rightMargin:16];
        _iconImageView = [[UIImageView alloc] initWithImage:BNDImageNamed(@"bnd_home_tuis_news")];
        _iconImageView.layer.cornerRadius = 6;
        _iconImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:_iconImageView];
        [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(36, 36));
            make.left.mas_equalTo(self.contentView.mas_left).offset(16);
            make.centerY.mas_equalTo(self.contentView);
        }];
        
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.text = @"杜舒兰";
        _titleLabel.font = BNDPFHeavyFont(16);
        _titleLabel.textColor = UIColorWithHex(0x34363B);
        _titleLabel.numberOfLines = 1;
        [self.contentView addSubview:_titleLabel];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.iconImageView.mas_right).offset(8);
            make.right.mas_equalTo(self.contentView.mas_right).offset(-35);
            make.centerY.mas_equalTo(self.contentView);
        }];
        
        
        
    }
    
    return self;
}

- (void)setModel:(BndUser *)model
{
    _model = model;
    _titleLabel.text = model.name;
    [_iconImageView lk_setImageFadeWithURLStr:model.avatar placeholder:BNDImageNamed(@"bnd_home_tuis_news")];
}

@end
